<?php
/**********************************************************
 		员工请假申请单据
 **********************************************************/
namespace src\logic\workflow;
use \classlib\core as C;
use \src\logic\workflow\doc_basic;
class doc_vacation extends doc_basic {
	//员工添加申请表单
	public function node1_submit(&$state) {
		return '1';
	}
	//部门领导审批
	public function node2_submit(&$state) {
		if ($this->method() != 'get') {//提交数据请求
			$where= array('workflowid'=>$state['workflowid'], 'preid'=>0);
			$node = C\model::load('main.proc.node')->get_item($where);
			$where= array('executionid'=>$state['executionid'], 'nodeid'=>$node['id']);
			$data = C\model::load('main.proc.nodestate')->get_item($where);
			$data = json_decode($data['json'], true);
			$stime= strtotime($data['etime']) - strtotime($data['stime']);
			return (abs($stime) / 86400 >= 5)? 1:-1;
		}
		return '-1';
	}
	//分管副总审批
	public function node3_submit(&$state) {
		return '-1';
	}
}
